package com.skyz.base.manager;

import android.app.Application;

import com.skyz.base.util.SharedPreferenceUtils;

public class SystemManager {

    private final String TAG = getClass().getSimpleName();

    //网络日志写文件
    private static final String NET_LOG_TO_FILE = "netLogToFile";

    private Application mApplication;

    private boolean mNetLogToFile = false;

    private SystemManager() {
    }

    private static class InstanceHolder {
        private static final SystemManager instance = new SystemManager();
    }

    public static SystemManager getInstance() {
        return InstanceHolder.instance;
    }

    public void init(Application application) {
        this.mApplication = application;
        initNetLogToFile();
    }

    private void initNetLogToFile() {
        if (mApplication == null) {
            return;
        }
        mNetLogToFile = SharedPreferenceUtils.getBooleanValue(mApplication, NET_LOG_TO_FILE, false);
    }

    public void setNetLogToFile(boolean netLogToFile) {
        mNetLogToFile = netLogToFile;
        if (mApplication == null) {
            return;
        }
        SharedPreferenceUtils.setValue(mApplication, NET_LOG_TO_FILE, mNetLogToFile);
    }

    public boolean getNetLogToFile() {
        return mNetLogToFile;
    }

}
